syntax = "proto3";

package qdrant;
option csharp_namespace = "Qdrant.Client.Grpc";

import "snapshots_service.proto";

service ShardSnapshots {
  /*
  Create shard snapshot
  */
  rpc Create (CreateShardSnapshotRequest) returns (CreateSnapshotResponse) {}
  /*
  List shard snapshots
  */
  rpc List (ListShardSnapshotsRequest) returns (ListSnapshotsResponse) {}
  /*
  Delete shard snapshot
  */
  rpc Delete (DeleteShardSnapshotRequest) returns (DeleteSnapshotResponse) {}
  /*
  Recover shard snapshot
  */
  rpc Recover (RecoverShardSnapshotRequest) returns (RecoverSnapshotResponse) {}
}

message CreateShardSnapshotRequest {
  string collection_name = 1; // Name of the collection
  uint32 shard_id = 2; // Id of the shard
}

message ListShardSnapshotsRequest {
  string collection_name = 1; // Name of the collection
  uint32 shard_id = 2; // Id of the shard
}

message DeleteShardSnapshotRequest {
  string collection_name = 1; // Name of the collection
  uint32 shard_id = 2; // Id of the shard
  string snapshot_name = 3; // Name of the shard snapshot
}

message RecoverShardSnapshotRequest {
  string collection_name = 1; // Name of the collection
  uint32 shard_id = 2; // Id of the shard
  ShardSnapshotLocation snapshot_location = 3; // Location of the shard snapshot
  ShardSnapshotPriority snapshot_priority = 4; // Priority of the shard snapshot
  optional string checksum = 5; // SHA256 checksum for verifying snapshot integrity
}

message ShardSnapshotLocation {
  oneof location {
    string url = 1; // URL of the remote shard snapshot
    string path = 2; // Path of the local shard snapshot
  }
}

enum ShardSnapshotPriority {
    ShardSnapshotPriorityNoSync = 0; // Restore snapshot without *any* additional synchronization
    ShardSnapshotPrioritySnapshot = 1; // Prefer snapshot data over the current state
    ShardSnapshotPriorityReplica = 2; // Prefer existing data over the snapshot
    ShardSnapshotPriorityShardTransfer = 3; // Internal priority to use during snapshot shard transfer
}

message RecoverSnapshotResponse {
  double time = 1; // Time in seconds spent to process request
}
